import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HomeComponent } from './home/home.component';
import { UsersComponent } from './users/users/users.component';
import { RolesComponent } from './users/roles/roles.component';
import { DepartmentComponent } from './users/department/department.component';
import { LoginComponent } from './login/login.component';

const routes: Routes = [
  { path: '', redirectTo: 'home', pathMatch: 'full', },
  { path: 'home',  component: HomeComponent, data: { breadcrumb: '首页', icon: 'home' }},
  { path: 'users', component: UsersComponent, data: { breadcrumb: '用户管理', icon: 'home', isChild: true } },
  { path: 'users/users', component: UsersComponent, data: { breadcrumb: '用户', icon: 'home' } },
  { path: 'users/roles', component: RolesComponent, data: { breadcrumb: '角色', icon: 'home' }},
  { path: 'users/departments', component: DepartmentComponent, data: { breadcrumb: '部门', icon: 'home' }},
  { path: 'login',  component: LoginComponent, data: { breadcrumb: '', icon: '' } },
  { path: 'lazy', loadChildren: () => import('./lazy/lazy.module').then(m => m.LazyModule),data: { breadcrumb: '懒加载', icon: 'home' }}, // ng generate module 名称 --route 名称 --module app.module   
  { path: 'about', loadChildren: () => import('./about/about.module').then(m => m.AboutModule),data: { breadcrumb: '关于', icon: 'home'} },
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
